<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        // entries() keys() values() 返回一个遍历器 可以使用for...of循环进行遍历
        // keys() 对键名遍历
        // values() 对键值遍历
        // entries() 对键值对遍历

        for (let index of ['a','b'].keys()){
            console.log(index);
        }

        for (let ele of ['a','b'].values()){
            console.log(ele);
        }

        for (let [index,ele] of ['a','b'].entries()){
            console.log(index,ele);
        }

        let letter = ['a','b','c'];
        let it = letter.entries();
        console.log(it.next().value);
        console.log(it.next().value);
        console.log(it.next().value);
        console.log(it.next().value);// 未定义返回undefined

        // includes() 返回一个布尔值，表示某个数组是否包含给定的值
        console.log([1,2,3].includes(2));
        console.log([1,2,3].includes('4'));

        // 之前 indexof(),省去判断是否等于-1的步骤
        console.log([1,2,3].indexOf('2'));
    </script>
</body>
</html>